package com.keshe.product.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.keshe.product.entity.ClassifyEntity;
import com.keshe.product.service.ClassifyService;
import com.keshe.common.utils.PageUtils;
import com.keshe.common.utils.R;



/**
 *
 *
 * @author yuzhengxiao
 * @email 1581106246@qq.com
 * @date 2023-01-02 12:59:12
 */
@RefreshScope
@RestController
@RequestMapping("product/classify")
public class ClassifyController {
    @Autowired
    private ClassifyService classifyService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("product:classify:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = classifyService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("product:classify:info")
    public R info(@PathVariable("id") Integer id){
		ClassifyEntity classify = classifyService.getById(id);

        return R.ok().put("classify", classify);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("product:classify:save")
    public R save(@RequestBody ClassifyEntity classify){
		classifyService.save(classify);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("product:classify:update")
    public R update(@RequestBody ClassifyEntity classify){
		classifyService.updateById(classify);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("product:classify:delete")
    public R delete(@RequestBody Integer[] ids){
		classifyService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
